/****************************************************************************
	This file is part of Basqet.

	Basqet is free software: you can redistribute it and/or modify
	it under the terms of the GNU General Public License as published by
	the Free Software Foundation, either version 3 of the License, or
	(at your option) any later version.

	Basqet is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
	GNU General Public License for more details.

	You should have received a copy of the GNU General Public License
    along with Basqet.  If not, see <http://www.gnu.org/licenses/>.

****************************************************************************/

#ifndef NOTEPADPAGE_H
#define NOTEPADPAGE_H

#include "notedata.h"
#include "uicapabilities.h"
#include <QtGui/QWidget>
#include <QPointer>
#include <QExplicitlySharedDataPointer>

class BasketContent;
class CommandManager;
class TagManager;


namespace Ui {
    class NotePadPage;
}

class QMouseEvent;

class NotePadPage : public QWidget {
    Q_OBJECT
	public:
		NotePadPage(QExplicitlySharedDataPointer<BasketContent> basketContent,
					QExplicitlySharedDataPointer<CommandManager> commandManager,
					QExplicitlySharedDataPointer<TagManager> tagManager,
					QWidget *parent = 0);
		~NotePadPage();

	public slots:
		void createNoteWidget(QExplicitlySharedDataPointer<NoteData> noteData);


	protected slots:
		void createNoteEvent(QPoint where);

		void objectActivated(QObject *, UICapabilities capabilities);


	protected:
		void changeEvent(QEvent *e);
		void mouseDoubleClickEvent(QMouseEvent* event);
		void installUndoRedoHandlers(QObject* target);

		void mousePressEvent(QMouseEvent* event);
		void enterEvent(QEvent* event);


	private:
		Ui::NotePadPage									*m_ui;
		QExplicitlySharedDataPointer<BasketContent>		mBasketContent;
		QExplicitlySharedDataPointer<CommandManager>	mCommandManager;
		QExplicitlySharedDataPointer<TagManager>		mTagManager;

		/// Indicates whether a note shall be activated or not uppon creation. Used to activate notes triggered by user action only.
		bool											mActivateNotes;

		QPointer<QWidget>								mActiveNote;
		UICapabilities									mActiveNoteCan;

	signals:
		void Clicked(QPoint where);

		void activated(QObject *, UICapabilities capabilities);
		void deActivated(QObject *, UICapabilities capabilities);



};

#endif // NOTEPADPAGE_H
